<template>
    <div class="allBody">
        <PositionBrowsingHead v-if="this.$store.state.IsSeeker === true"></PositionBrowsingHead>
        <CheckResumesHead v-if="this.$store.state.IsSeeker === false"></CheckResumesHead>
        <ResumeInfoDetailHead :selfInfo.sync="seekers" :expJob.sync="resume.expectionJob">
        </ResumeInfoDetailHead>
        <ResumeInfoDetail></ResumeInfoDetail>
        <ResumeInfoReply v-if="this.$store.state.IsSeeker === false"></ResumeInfoReply>
    </div>
</template>
<script>
import axios from 'D:\\job_management\\src\\axiosConfig.js'
import PositionBrowsingHead from '@/components/PositionBrowsingHead.vue';
import CheckResumesHead from '@/components/CheckResumesHead.vue';
import ResumeInfoDetailHead from '@/components/ResumeInfoDetailHead.vue'
import ResumeInfoDetail from '@/components/ResumeInfoDetail.vue';
import ResumeInfoReply from '@/components/ResumeInfoReply.vue';
import { mapState, } from 'vuex';
export default {
    name: 'ResumeInfo',
    components: { CheckResumesHead, ResumeInfoDetailHead, ResumeInfoDetail, ResumeInfoReply, PositionBrowsingHead },

    data() {
        return {
            resume:
            {
                resumeId: 1,
                seekersAccount: 2713,
                expectionJob: '软件工程师',
                educationBackground: '南华大学本科毕业，华南大学硕士毕业',
                project: '火星大气管理系统构建者',
                skills: '很会java',
                selfEvaluation: '很棒！',
            },
            seekers: {
                account: 2713,
                seekersName: '李白',
                sex: '男',
                age: '23',
                education: '本科',
                email: '271375@qq.com',
                profession: '软件工程',
                phone: '18978952451',
            },
        }
    },
    computed: {
        ...mapState(['account', 'resumeId']),
    },
    mounted() {
        //此处应向后端请求各项数据

        //求职者请求求职者自己的简历信息
        if (this.$store.state.IsSeeker === true) {
            axios.get(`/seekers/resume/information/${this.$store.state.resumeId}`,
            ).then(res => {
                this.resume = res.data.data
                this.$store.commit('changeExpJob', res.data.data.expectionJob)
                console.log(res.data.data.expectionJob);
            }).catch(err => {
                console.log(err);
            })
            axios.get(`/seekers/infomation/${this.$store.state.account}`,
                {


                },
            )
                .then(response => {
                    this.$data.seekers = response.data.data
                })
                .catch(error => {
                    console.log(error);
                })
        }

        //公司请求简历信息
        else {
            axios.post('/company/resumedetail/get',
                {

                    account: this.$store.state.account,
                    resumeId: this.$store.state.resumeId

                }).then(res => {
                    console.log(res);
                    this.resume = res.data.data.resume;
                    this.seekers.account = res.data.data.seekers.account;
                    this.seekers.sex = res.data.data.seekers.sex;
                    this.seekers.age = res.data.data.seekers.age;
                    this.seekers.education = res.data.data.seekers.education;
                    this.seekers.email = res.data.data.seekers.email;
                    this.seekers.profession = res.data.data.seekers.profession;
                    this.seekers.phone = res.data.data.user.phone;
                }).catch(err => {
                    console.log(err);
                })
        }
    },
    methods: {


        turnback() {
            this.$router.push('/CheckResumes');
        }
    }
}
</script>
<style scoped>
.allBody {
    width: 100%;
    height: 100%;
    background-color: rgb(227, 243, 246);
}
</style>